﻿using System;
using System.ComponentModel.Composition;

namespace Neudesic.Pulse.Infrastructure
{

    /// <summary>
    /// Attribute that adds the ability for a view to be exported for region consumption.
    /// </summary>
    /// <remarks>
    /// Using this attribute results in a Lazy<T, Metadata>.
    /// </remarks>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
    [MetadataAttribute]
    public class ViewExportAttribute : ExportAttribute, IViewRegionRegistration
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ViewExportAttribute" /> class.
        /// </summary>
        public ViewExportAttribute()
            : base(typeof(object))
        { }

        /// <summary>
        /// Initializes a new instance of the <see cref="ViewExportAttribute" /> class.
        /// </summary>
        /// <param name="viewName">Name of the view.</param>
        public ViewExportAttribute(string viewName)
            : base(viewName, typeof(object))
        { }

        /// <summary>
        /// Gets or sets the name of the region.
        /// </summary>
        /// <value>The name of the region.</value>
        public string RegionName { get; set; }
    }

}
